import matplotlib.pyplot as plt
import numpy as np
from numpy.typing import NDArray

def render(data:NDArray):
  cmap = {
    1:'gray',
    0:'red',
    'G':'white',
    'M':'gray',
    'R':'#b38b4f',
    'T':'#b38b4f',
    'W':'#b38b4f',
    "FH":"red",
    'CH':"red",
    'RH':'red',
    'PH':'red',
    'OH':'red',
    'B':"green",
    'P':'blue',
    'A':'cyan'
  }


  fig, ax = plt.subplots()


  for i in range(data.shape[0]):
      for j in range(data.shape[1]):
          rect = plt.Rectangle((j, i), 1, 1, facecolor =cmap.get(data[i,j]), edgecolor='black', linewidth = 0.5)
          ax.add_patch(rect)


  ax.set_xlim(0, data.shape[1])
  ax.set_ylim(data.shape[0], 0)
  ax.set_aspect('equal')
  ax.axis('off')


  plt.show()
